home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT6 / INTLOC.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-08-27  |  3.0 KB  |  76 lines

  1. ;
  2. ;       Program IntLoc ( Chapter 6 )
  3. ;
  4. page    59,132
  5. ;
  6. ;                        Program   IntLoc
  7. ;                        ════════════════
  8. ;
  9. ;                    Voronezh, 30 January 91
  10. ;                    ───────────────────────
  11. ;
  12. ;       This is a sample of an assembler program that uses a simple
  13. ;       DOS service.  It outputs  the  table of interrupts onto the
  14. ;       system  output  device  and reports where the corresponding
  15. ;       handler is located.  The letter B means BIOS, the  letter
  16. ;       D - DOS, the letter N - not set (dummy handler).
  17. ;
  18. .model small
  19. .stack
  20. .data
  21. tbint   db      16 dup ('xx-X ') , '$'
  22. HexSym  db      '0','1','2','3','4','5','6','7'
  23.         db      '8','9','A','B','C','D','E','F'
  24. NumInt  db      0
  25. NumIntL db      0
  26. .code
  27.         mov     ax,@data
  28.         mov     ds,ax
  29.  
  30.         mov     cx,16           ; Line counter
  31. Rows:                           ; Lines cycle starts here
  32.         push    cx              ; Save outward counter
  33.         mov     di,0            ; Counter within line
  34.         mov     cx,16           ; Columns counter
  35.         mov     al,NumInt
  36.         mov     NumIntL,al
  37. Intrs:                          ;
  38.         mov     al,NumintL      ; Load interrupt number
  39.         mov     ah,35h          ; Get interrupt vector (DS:BX)
  40.         int     21h             ; DOS sevice call
  41.         mov     dx,es           ; Segment addres of interrupt handler
  42.         cmp     dx,0A000h       ; Compare it to the BIOS start address
  43.         ja      InBios          ; If DX is greater - handler is in BIOS
  44.         mov     tbint[di+3],'D' ; Set indicator 'DOS'
  45.         jmp     DoneInd         ; To the end of block
  46. InBios: mov     tbint[di+3],'B' ; Set indicator 'BIOS'
  47. DoneInd:                        ; This is the end of block
  48.  
  49.         cmp     byte ptr es:[bx],0CFh   ; First instruction IRET?
  50.         jne     PresHan                 ; If not - handler presented
  51.         mov     tbint[di+3],'N' ; Set indicator 'Not set'
  52. PresHan:                        ;
  53.         mov     ah,0            ; AL keeps the interrupt number
  54.         mov     dl,16           ; Prepare to converting AL to symbols
  55.         div     dl              ; AX / 16
  56.  
  57.         mov     bx,offset HexSym
  58.         xlat
  59.         mov     byte ptr tbint[di],al   ;    symbol into output line
  60.         mov     al,ah
  61.         xlat
  62.         mov     byte ptr tbint[di+1],al   ;    symbol into output line
  63.  
  64.         add     di,5            ; Next position in the line
  65.         add     NumIntL,16      ; Increase interrupt number
  66.         loop    Intrs           ; Next step - next interrupt
  67.         pop     cx              ; Restore cycle counter
  68.         mov     ah,09           ; Function 09 - output string
  69.         mov     dx,offset tbint ; Addres of string in DS:DX
  70.         int     21h             ; Output one string
  71.         inc     NumInt          ;
  72.         loop    Rows            ; Next step - next string
  73.         mov     ax,4C00h
  74.         int     21h
  75.         end                     ;
  76.